package dao.impl;

import dao.UserDao;
import model.User;
import utils.DaoUtil;
import utils.GenicaDaoImpl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class UserDaoImpl extends GenicaDaoImpl<User,Integer> implements UserDao {

    User user =new User();
    @Override
    public User findUserByUserId(int id){
        String sql = "SELECT * FROM user WHERE id=?";
        user = DaoUtil.query(User.class,sql,id);
        return user;
    }

    @Override
    public User findUserByEmail(String email) {
        String sql = "SELECT * FROM user WHERE email=?";
        user = DaoUtil.query(User.class,sql,email);
        return user;
    }

    @Override
    public User findUserByPhone(String phone) {
        String sql = "SELECT * FROM user WHERE phone=?";
        user = DaoUtil.query(User.class,sql,phone);
        return user;
    }

}
